<?php
class App_Module_Admin_Component_Structure_Tpl_Editbodyform extends App_Module_Admin_Tpl_Block_Editform
{
	protected $_form = 'entity/structure_body';
	
	public function GetForm($cid, $category)
	{
		$this->cid = $cid;
        $this->category = $category;

		return $this->CreateForm($category);
	}

	protected function GetActionUrl()
	{
		return array('module' => 'admin', 'ctrl' => 'structure', 'action' => 'savebody', 'subcat' => $this->category->GetId(), 'cat' => $this->cid );
	}
	
	protected function GetBackUrl()
	{
		return array('module' => 'admin', 'ctrl' => 'structure', 'action' => 'list', 'cat' => $this->cid);
	}
	
	protected function GetHeaderTitle()
	{
		return Mozg_Lang::_('CONTENT_EDIT');
	}
	
	protected function GetHeaderIcons()
	{
        $icons[0] = array(
        	'add' => array(
        					'title' => 'ADD',
        					'url' => Mozg_Router::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'structure', 'action' => 'add', 'cat' => $this->cid))
        					),
        );
        
        if ($this->category->GetId() && (!$this->category->GetBlocked() || Mozg::User()->IsSuperUser()))
        {
	        $icons[1] = array(
	        	'delete' => array(
	        					'title' => 'DELETE_CATEGORY?',
	        					'url' => Mozg_Router::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'structure', 'action' => 'del', 'cat' => $this->cid , 'subcat' => $this->category->GetId()))
	        					),
	        );
        }
        
        $icons[1]['edit'] = array(
        					'title' => 'GO_TO_CATEGORY_EDIT',
        					'url' => Mozg_Router::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'structure', 'action' => 'add', 'cat' => $this->cid , 'subcat' => $this->category->GetId()))
        					);
        
        return $icons;
	}
}